package com.nttuan.util;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.widget.Toast;

import com.nttuan.mycalender.R;

/**
 * Created by TuanNT on 11/7/2014.
 */
public class SysApp {

    public static boolean call(Context context, String phoneNumber) {
        Intent callIntent = new Intent(Intent.ACTION_CALL);
        callIntent.setData(Uri.parse(phoneNumber));
        try {
            context.startActivity(callIntent);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    public static boolean sendEmail(Context context, String[] address) {
        Intent i = new Intent(Intent.ACTION_SEND);
        i.setType("message/rfc822");
        i.putExtra(Intent.EXTRA_EMAIL, address);
        try {
            context.startActivity(Intent.createChooser(i, "Send mail..."));
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
